package com.popcorn.notice.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.popcorn.action.Action;
import com.popcorn.action.ActionForward;
import com.popcorn.notice.dao.NoticeDAO;

public class NoticeDeleteAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		NoticeDAO noticeDAO = new NoticeDAO();
		boolean result=false;
		
		int idx = Integer.parseInt(request.getParameter("idx"));
		
		result = noticeDAO.modelDelete(idx);
		
		if(result==false){
   			System.out.println("DB 삭제 실패");
   			return null;
   		}
   		System.out.println("DB 삭제 성공");
		
   		ActionForward forward= new ActionForward();
	   	forward.setRedirect(false);
   		forward.setPath("NoticeListDB.ao");
   		return forward;
	}

}
